Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sonoff dual #32 #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ricardojlrufino
Copy link

@ricardojlrufino ricardojlrufino commented Jun 8, 2018

Attention, this will break single sonoff .... =/

@@ -186,7 +200,7 @@ module.exports.createServer = function (config) {
if (!device) {
log.error('ERR | WS | Unknown device ', data.deviceid);
} else {
device.state = data.params.switch;
device.state = data.params.switches;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is dual specific, and will break the functionality of other devices


if(index > dstate.length - 1) return "not found";

dstate[index]['switch'] = (switchState ? "on" : "off");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again dual specific implementation.

@@ -1,5 +1,5 @@
module.exports.createServer = function (config) {
const CONNECTION_IS_ALIVE_CHECK_INTERVAL = 30000;
const CONNECTION_IS_ALIVE_CHECK_INTERVAL = 5000;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know you want to see immediately if a device is offline. But this will send a message every 5 secounds to all devices. This is a little bit too much. If you want this short timings, it would be best to add it to a config and let everybody choose how long they want the interval

"action": a.action,
"deviceid": a.target,
"params": a.value,
"userAgent": "app",
"sequence": Date.now().toString(),
"ts": 0,
"from": "app"
// "ts": 0,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this interface changed? are there new informations available about sonoff devices?


device.isAlive = true;

if(message.params.switches){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please add an "else" where the old behaviour is triggered? so that the other devices will still work?

@mdopp
Copy link
Owner

mdopp commented Jun 8, 2018

@ricardojlrufino
Hi, have you seen pull request #23 ? Can you please have a look, if that solves your problem as well?

@ricardojlrufino
Copy link
Author

Sorry i have no time to review... I'm implementing in java ... = /
I just put the changes I had to make, maybe to help other people

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants